package com.vinaprime.primeschedule.databaselayer;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class VPLanguage_DL {

	private static final String DB_TABLE_NAME = "VP_LANGUAGE";
	private static final String DB_TABLE_COL_ROWID = "_id";
	private static final String DB_TABLE_COL_ID = "VPL_ID";
	private static final String DB_TABLE_COL_CODE = "VPL_CODE";
	private static final String DB_TABLE_COL_NAME = "VPL_NAME";
	private static final String DB_TABLE_COL_DESCRIPTION = "VPL_DESCRIPTION";
	private static final String DB_TABLE_COL_ENABLE_FLAG = "VPL_ENABLE_FLAG";
	
	private DatabaseController_DL myDatabaseControllerDL;
	
	public VPLanguage_DL(Context context, String path){
		myDatabaseControllerDL = new DatabaseController_DL(context, path);
	}

	public static String getDbTableName() {
		return DB_TABLE_NAME;
	}

	public static String getDbTableColRowid() {
		return DB_TABLE_COL_ROWID;
	}

	public static String getDbTableColId() {
		return DB_TABLE_COL_ID;
	}

	public static String getDbTableColCode() {
		return DB_TABLE_COL_CODE;
	}

	public static String getDbTableColName() {
		return DB_TABLE_COL_NAME;
	}

	public static String getDbTableColDescription() {
		return DB_TABLE_COL_DESCRIPTION;
	}

	public static String getDbTableColEnableFlag() {
		return DB_TABLE_COL_ENABLE_FLAG;
	}
	
	public Cursor getAllLanguage()
	{
		SQLiteDatabase db = this.myDatabaseControllerDL.getWritableDatabase();
		
		String selectQuery = "SELECT  " + VPLanguage_DL.DB_TABLE_COL_ID + " AS " + VPLanguage_DL.DB_TABLE_COL_ROWID + ", " +
											VPLanguage_DL.DB_TABLE_COL_ID + ", " +
											VPLanguage_DL.DB_TABLE_COL_CODE + ", " +
											VPLanguage_DL.DB_TABLE_COL_NAME + ", " +
											VPLanguage_DL.DB_TABLE_COL_DESCRIPTION + ", " +
											VPLanguage_DL.DB_TABLE_COL_ENABLE_FLAG +
								" FROM " + DB_TABLE_NAME +
								" WHERE 1 = 1 " +
								" ORDER BY " + VPLanguage_DL.DB_TABLE_COL_CODE;
		
		Cursor cur = db.rawQuery(selectQuery, null);
		
		return cur;
	}
}
